from django.conf.urls.defaults import *
from music.models import *


genre_list = {
  'queryset': Genre.objects.all(),
}
label_list = {
  'queryset': Label.objects.all(),
}
band_list = {
  'queryset': Band.objects.all(),
}
album_list = {
  'queryset': Album.objects.all(),
}
track_list = {
  'queryset': Track.objects.all(),
}


urlpatterns = patterns('',  
  # Genres
  url(
    regex   = '^genres/(?P<slug>[-\w]+)/$',
    view    = 'django.views.generic.list_detail.object_detail',
    kwargs  = genre_list,
    name    = 'music_genre_detail',
  ),
  url (
    regex   = '^genres/$',
    view    = 'django.views.generic.list_detail.object_list',
    kwargs  = genre_list,
    name    = 'music_genre_list',
  ),
  
  # Labels
  url(
    regex   = '^labels/(?P<slug>[-\w]+)/$',
    view    = 'django.views.generic.list_detail.object_detail',
    kwargs  = label_list,
    name    = 'music_label_detail',
  ),
  url (
    regex   = '^labels/$',
    view    = 'django.views.generic.list_detail.object_list',
    kwargs  = label_list,
    name    = 'music_label_list',
  ),
  
  # Bands
  url(
    regex   = '^bands/(?P<slug>[-\w]+)/$',
    view    = 'django.views.generic.list_detail.object_detail',
    kwargs  = band_list,
    name    = 'music_band_detail',
  ),
  url (
    regex   = '^bands/$',
    view    = 'django.views.generic.list_detail.object_list',
    kwargs  = band_list,
    name    = 'music_band_list',
  ),
  
  # Albums
  url(
    regex   = '^albums/(?P<slug>[-\w]+)/$',
    view    = 'django.views.generic.list_detail.object_detail',
    kwargs  = album_list,
    name    = 'music_album_detail',
  ),
  url (
    regex   = '^albums/$',
    view    = 'django.views.generic.list_detail.object_list',
    kwargs  = album_list,
    name    = 'music_album_list',
  ),
  
  # Tracks
  url(
    regex   = '^tracks/(?P<slug>[-\w]+)/$',
    view    = 'django.views.generic.list_detail.object_detail',
    kwargs  = track_list,
    name    = 'music_track_detail',
  ),
  url (
    regex   = '^tracks/$',
    view    = 'django.views.generic.list_detail.object_list',
    kwargs  = track_list,
    name    = 'music_track_list',
  ),
  
  url (
    regex   = '^$',
    view    = 'django.views.generic.simple.direct_to_template',
    kwargs  = {'template': 'music/index.html'},
    name    = 'music_index',
  ),
)